package com.lry.basic.algorithm.simple;


public class ReverseVowels {
    public static void main(String[] args) {
        reverseVowels("hello");
    }
    public static String reverseVowels(String s) {
        char[] cs = s.toCharArray();
        String yuan = "aeiouAEIOU";
        int i=0,j=cs.length-1;
        while(i<j){
            while(i<s.length()&&!yuan.contains(""+cs[i])){
                i++;
            }
            while(j>=0&&!yuan.contains(""+cs[j])){
                j--;
            }
            if(i<j){
                char t = cs[i];
                cs[i] = cs[j];
                cs[j] = t;
                i++;
                j--;
            }
        }
        return new String(cs);
    }
}
